<%@ page

import="web.Users"
import="java.util.*"
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <meta charset="utf-8">
<%
String g_uid=request.getParameter("uid");
String uname=request.getParameter("uname");
String pword=request.getParameter("pword");
HttpSession s=request.getSession();
if(g_uid!=null&&uname!=null&&pword!=null&&!g_uid.equals("")){
	int uid=Integer.parseInt(g_uid);
	String c_uname=Users.getUser(uid);
	int c_uid=Users.checkUname(uname);
	if(!c_uname.equals("")){
		%>用户账号已存在!<%
	}else if(c_uid!=0){
		%>用户昵称已存在！<%
	}else{
		Users.addUser(uid, uname, pword);
		s.setAttribute("uid", uid);
		s.setAttribute("uname", uname);
		response.sendRedirect("index.jsp");
		
	}
}else{
	%>请输入注册信息！<%
}
%>

<form action="" method="get">

<p>账号<input type="text" name="uid"></p>
<p>密码<input type="password" name="pword"></p>
<p>昵称<input type="text" name="uname"></p>
<p><input type="submit"></p>
</form>